<template>
  <div>
    <c-title :hide="false" text="搜索"></c-title>
    <div class="head">
      <div class="inpbox">
        <i class="iconfont icon-sousuo1" @click.stop="searchClick"></i>
        <input type="text" placeholder="请输入搜索内容" v-model="query.title" @keydown.enter="searchClick" />
      </div>
    </div>
    <div class="search-main">
      <div class="title"></div>
      <div class="search-goods flex-j-sb" v-if="goodsList.length > 0">
        <block v-for="(item, index) in goodsList" :key="index">
          <div class="goods-item flex" @click="goodsNavTo(item.id)">
            <div class="goods-img">
              <img :src="item.thumb" />
              <div class="number">已售{{ item.show_sales }}</div>
            </div>
            <div class="fine-food flex-j-sb flex-a-c">
              <div class="fine">{{ item.title }}</div>
              <div class="long-title">{{item.long_title}}</div>
            </div>
            <div class="flex-a-c">
              <div class="s3-price">
                <small>￥</small>
                <span>{{ item.price }} </span>
              </div>
              <div class="s2">
                <span>原价 ¥{{ item.market_price }}</span>
              </div>
            </div>
          </div>
        </block>
      </div>
      <van-empty description="空空如也" v-else />
    </div>
  </div>
</template>
<script>
import tourSearchPage from "./tourSearchPage.js";
export default tourSearchPage;
</script>
<style scoped>
.inpbox::v-deep .van-cell {
  background: transparent;
  padding: 0;
}
</style>
<style lang="scss" scoped>
.mb20 {
  height: 0.625rem;
  clear: both;
}

.head {
  width: 100%;
  // border-bottom: 0.0313rem solid #e4e4e4;
  padding: 0.9375rem 0.9375rem 0.625rem 1.125rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.inpbox {
  width: 21.4375rem;
  height: 1.9375rem;
  border-radius: 1.0313rem;
  background: #fff;
  border: 1px solid var(--themeBaseColor);
  display: flex;
  align-items: center;
}

.head span {
  font-size: 0.875rem;
  margin-left: 0.6875rem;
}

.inpbox {
  .iconfont {
    margin-left: 1.0625rem;
    margin-right: 0.4375rem;
    color: var(--themeBaseColor);
  }

  input {
    flex: 1;
    display: flex;
    align-items: center;
    border: none;
  }
}

.mb-20 {
  margin-bottom: 0.625rem;
}

.f-wrap {
  flex-wrap: wrap;
}

.search-main .title {
  margin: 0.9375rem 0 1rem 0.625rem;
  font-size: 0.875rem;
  color: #222;
  text-align: left;
}

.look-over {
  font-size: 0.75rem;
  color: #979797;
}

.commercial-title {
  font-size: 0.8462rem;
  color: #222;
  margin: 1.5625rem 0 1rem 0.625rem;
  text-align: left;
}

.address .mean-tag {
  font-size: 0.625rem;
  color: #222;
  white-space: nowrap;
  padding: 0.2188rem 0.375rem 0.1875rem 0.2813rem;
  background-color: #f3f3f5;
  margin-right: 0.3438rem;
}

.mean-line {
  font-size: 0.9375rem;
  margin-right: 0.3438rem;
}

/* 商品信息 */

.search-goods {
  flex-wrap: wrap;
  margin: 0 0.625rem;
}

.goods-item {
  width: 10.7813rem;
  background-color: #fff;
  border-radius: 30rpx;
  flex-direction: column;
  padding: 0 0 0.625rem 0;
  margin-bottom: 0.625rem;

  .goods-img {
    width: 10.7813rem;
    height: 10.7813rem;
    border-radius: 0.4688rem 0.4688rem 0 0;
    position: relative;

    img {
      width: 100%;
      right: 0;
      height: 100%;
      position: absolute;
      border-top-left-radius: 0.5rem;
      border-top-right-radius: 0.5rem;
    }

    .number {
      width: 100%;
      text-align: left;
      padding: 0.1875rem 0 0.1875rem 0.625rem;
      position: absolute;
      bottom: 0;
      font-size: 11px;
      color: #fff;
      background-color: rgba(255, 255, 255, 0.5);
    }
  }

  .s3-price {
    line-height: 1.5625rem;
    height: 1.375rem;
    margin-left: 10px;
    overflow: hidden;
    color: #fb4a4a;
    text-align: left;
  }

  .s2 {
    text-decoration: line-through;
    vertical-align: middle;
    color: #999;
    font-size: 12px;
    height: 1rem;
    line-height: 1.25rem;
    margin-left: 0.375rem;
  }
}

.goods-img {
  .label {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 99;
    font-size: 0.75rem;
    color: #fff;
    background: linear-gradient(90deg, #ff6a3f 0%, #ff3b01 100%);
    padding: 0 0.2188rem;
    border-radius: 0.4688rem 0 0.4688rem 0;
  }

  .store-name {
    width: 100%;
    height: 1.6563rem;
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 5;
    background-color: rgba(255, 255, 255, 0.5);
    align-items: center;
    font-size: 0.6875rem;
    color: #fff;
  }
}

.store-name {
  .icon-service_n {
    color: #fff;
    font-size: 0.6875rem;
  }

  .units {
    margin-right: 0.25rem;
  }
}

.goods-name {
  margin: 0.625rem 1.125rem 0.7188rem 0.4688rem;

  .goods-title {
    font-size: 0.8125rem;
    color: #35314a;
  }
}

.fine-food {
  margin: 0.625rem 0.625rem 0 0.625rem;
  flex-direction: column;
}

.fine {
  font-size: 0.9rem;
  line-height: 1.625rem;
  color: #35314a;
  font-weight: bold;
  text-align: left;
  width: 100%;
}

.long-title {
  font-size: 0.8rem;
  color: #818181;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  text-align: left;
  margin: 0.1rem 0 0.2rem 0;
}

.fine-food .number {
  font-size: 0.625rem;
  color: #b5b5b5;
}
</style>
